package com.example.provider02;

import com.example.provider02.client.LittleProvider01Client;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class Provider02Controller {

    @Autowired
    private LittleProvider01Client littleProvider01Client;

    @GetMapping("/hello")
    public String hello() {
        return "Hello from Service Provider!";
    }

    @GetMapping("/users/{userId}")
    public String getUserById(@PathVariable("userId") Long userId) {
        return littleProvider01Client.getUserById(userId);
    }
}